home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Varios Español
/
Varios Español.iso
/
PMAKER65
/
archive.z
/
REDIMENSIONAR GRUPO....SPT
< prev
next >
Wrap
Text File
|
1996-11-10
|
9KB
|
300 lines
-- Resize Group...
-- 1 Oct 96, vs
-- Este gui≤n redimensiona todos los elementos en un grupo
-- incluyendo bloques de texto. Los tama±os y anchuras de fuentes
-- se ajustarßn a las nuevas dimensiones.
getselectidlisttop >> N,...,...,...,...,typ,...
if not(N,typ=1,14)
return unquote("Estado no vßlido")
endif
// Pre-Step 1: Scan all textblocks in a group;
// list 'em by IDs
getselectidlisttop >> ...,idg,...
getgrouplist idg >> N,grouplist
groupidlist =
loop n=1,N
set grouplist >> id,...,...,...,typ,...,...,...,...,...,...,...,...,...,...,grouplist
if typ = 1
groupidlist = groupidlist,id
endif
endloop
storyid.dejavu = //dont bother twice about the same story within the group
deselect
// Pre-Step 2: Scan all the stories in the group:
// If some story has a textblock outside the group - bail out
getgrouplist idg >> N,grouplist
loop n=1,N
set grouplist >> id,...,...,...,typ,...,...,...,...,...,...,...,...,...,...,grouplist
//message str(typ)
if typ = 1
selectid id
textedit
gettextcursor >> storyid,pos,...
if not ( storyid ? storyid.dejavu )
storyid.dejavu = storyid.dejavu , storyid
textcursor +story
repeat
textcursor -char
textcursor -textblock
gettextlocation >> idtxt,...
if not ( idtxt ? groupidlist )
return unquote("Estado no vßlido")
endif
gettextcursor >> ...,pos,...
until pos=0
endif
endif
endloop
deselect
// Pre Step 3 : remember transformation of a textblocks
selectid idg
getgrouplist idg >> N,grouplist
loop n=1,N
set grouplist >> id,...,...,...,typ,...,...,...,...,...,...,...,...,...,...,grouplist
if typ = 1
selectid id
gettransform >> rot[id],skew[id],...
textedit
gettextcursor >> ...,begin[id],...
textcursor +textblock
gettextcursor >>...,end[id],...
textselect +char
textenter ""(0x(13))
deselect
endif
endloop
deselect
selectid idg
// Now, as the task looks doable, accept and handle user's input.
getobjectloc center => xc,yc
getplatform => platform
if platform = WINDOWS
dialogbegin -65,-80,65,30,"Escalar grupo"
pushbutton 88,30,122,44,"OK"
pushbutton 88,51,122,65,"Cancelar"
edit 28,7,45,17,"100"
static 48,8,54,18,"%"
static 3,8,24,18,"Altura"
edit 97,7,114,17,"100"
static 116,8,122,18,"%"
static 65,8,95,18,"Anchura"
static 5,22,62,32,"Punto de anclaje:"
radiobutton 10,32,82,44,"Superior izquierdo.",1
radiobutton 10,44,82,56,"Superior derecho."
radiobutton 10,56,88,68,"Inferior derecho."
radiobutton 10,68,81,80,"Inferior izquierdo."
radiobutton 10,82,44,94,"Propio: "
static 44,82,56,94,"x "
edit 58,82,86,91,""(xc)
static 44,94,56,104,"y"
edit 58,94,86,102,""(yc)
dialogend => ButtonHit,...,...,kh,...,...,kw,...,...,...,lt,rt,rb,lb,cust,...,xc,...,yc,...
else
dialogbegin -165,-200,165,75,"Escalar grupo"
pushbutton 232,82,298,108,"OK"
pushbutton 230,130,300,160,"Cancelar"
static 25,55,130,80,"Punto de anclaje:"
radiobutton 25,80,205,110,"Superior izquierdo.",1
radiobutton 25,110,205,140,"Superior derecho."
radiobutton 25,140,220,170,"Inferior derecho."
radiobutton 25,170,205,200,"Inferior izquierdo."
radiobutton 25,205,110,240,"Propio: "
static 110,205,140,240,"x "
edit 145,205,215,227,""(xc)
static 110,235,140,265,"y"
edit 145,235,215,257,""(yc)
edit 70,22,110,42,"100"
static 120,22,135,50,"%"
static 8,22,60,50,"Height"
edit 240,22,275,42,"100"
static 285,22,305,50,"%"
static 175,22,235,50,"Anchura"
dialogend => ButtonHit,...,...,...,lt,rt,rb,lb,cust,...,xc,...,yc,kh,...,...,kw,...,...
endif
if (ButtonHit="Cancelar")+empty(ButtonHit)
return
endif
set ~""(kh)/100=> kh
set ~""(kw)/100=> kw
set ~""(xc)=>xc
set ~""(yc)=>yc
// Pre-Step 3: Secure all textblock in a group against loosing 'em when resizing
// or changing text attributes. Put more text in each story
--kw = 1.5
--kh = 0.8
k = max(1,kw)*max(1,kh)-1
k = trunc(k)+1
getgrouplist idg >> N,grouplist
loop n=1,N
set grouplist >> id,...,...,...,typ,...,...,...,...,...,...,...,...,...,...,grouplist
if typ=1
selectid id
textedit
gettextcursor >> ...,pos,...
if pos=0
selectall
copy
textcursor +story
gettextcursor >> ...,begin.tmp[id],...
loop i = 1,k
paste
endloop
gettextcursor >> ...,end.tmp[id],...
endif
endif
endloop
// now resize group
selectid idg
switch lt,rt,rb,lb
caseof 1,0,0,0
resizepct rightbottom,kw*100,kh*100
break
caseof 0,1,0,0
resizepct leftbottom,kw*100,kh*100
break
caseof 0,0,1,0
resizepct lefttop,kw*100,kh*100
break
caseof 0,0,0,1
resizepct righttop,kw*100,kh*100
break
default
getobjectloc lefttop >> xLT,yLT
getobjectloc rightbottom >> xRB,yRB
set xc+kw*(xLT-xc) => xLT
set yc+kh*(yLT-yc) => yLT
set xc+kw*(xRB-xc) => xRB
set yc+kh*(yRB-yc) => yRB
resize lefttop,xLT,yLT
resize rightbottom,xRB,yRB
endswitch
// Post Step 1: adjust text attributes
getgrouplist idg >> N,grouplist
loop n=1,N
//breakpoint
set grouplist >> id,...,...,...,typ,...,...,...,...,...,...,...,...,...,...,grouplist
if typ=1
// calculate virtual koefficients of text attributes
m11 = kw*cos(rot[id])
m21 = -kh*sin(rot[id])
m12 = kw*(sin(rot[id]) - cos(rot[id])*sin(skew[id])/cos(skew[id]) )
m22 = kh*(sin(rot[id])*sin(skew[id])/cos(skew[id])+cos(rot[id]) )
kx = sqrt ( m11*m11+m21*m21)
ky = abs(m11*m22-m12*m21)/kx
selectid id
textedit
gettextcursor >> ...,pos,...
if 1
settextcursor -2,begin[id],end[id]
gettextcursor >> ...,begin,end
settextcursor -2,begin,begin
set begin => tc
while tc<end
textselect +para
gettextcursor => ...,tc,tc1
gethyphenation => cState,nHyphenLimit,xZone
hyphenation cState,nHyphenLimit,min(2,kx*xZone)
getindents => xLeftIndent,xFirstIndent,xRightIndent
indents min(kx*xLeftIndent,21),(abs(kx*xFirstIndent+21)-abs(kx*xFirstIndent-21))/2,min(21,kx*xRightIndent)
getleading => leading
if leading>-1
leading min(ky*leading,1300)
endif
getparaspace => ySpaceBefore,ySpaceAfter
paraspace min(ky*ySpaceBefore,22),min(ky*ySpaceAfter)
getruleabove => bRuleOn,cLineStyle,sLineColor,cLineWidth,xLeftIndent,xRightIndent,dWeight,bOpaque
if bRuleOn
ruleabove bRuleOn,cLineStyle*not(cLineStyle=31),sLineColor,ky*cLineWidth,min(kx*xLeftIndent,21),min(kx*xRightIndent,21),trunc(0.5+k*dWeight*10)/10,bOpaque
endif
getrulebelow => bRuleOn,cLineStyle,sLineColor,cLineWidth,xLeftIndent,xRightIndent,dWeight,bOpaque
if bRuleOn
rulebelow bRuleOn,cLineStyle*not(cLineStyle=31),sLineColor,ky*cLineWidth,min(kx*xLeftIndent,21),min(kx*xRightIndent,21),trunc(0.5+k*dWeight*10)/10,bOpaque
endif
getruleoptions => yTopOffset,yBottomOffset,bAlighnToGrid,dGridSize
if yTopOffset>-1
set min(ky*yTopOffset,22.75) => yTopOffset
endif
if yBottomOffset>-1
set min(ky*yBottomOffset,22.75) => yBottomOffset
endif
ruleoptions yTopOffset,yBottomOffset,bAlighnToGrid,min(ky*dGridSize,1300)
getsize => size
if size >-2
size max(4,min(ky*size,650))
endif
getwidth => width
if width>0
set width*kx/ky => width
width = min(width,250)
width = max(width,5)
setwidth width
endif
if (size=-2)+(leading=-2)+(width=-2)
textselect -para
set tc => tr
while tr<tc1
gettextrun 1 => ...,...,tr,...
textselect +char,tr-tc
getleading => leading
if leading > -1
leading min(ky*leading,1300)
endif
getsize => size
size max(4,min(ky*size,650))
getwidth => width
set width*kx/ky => width
width = min(width,250)
width = max(width,5)
setwidth width
textselect -char,tr-tc
textcursor +char,tr-tc
set tr=> tc
endwhile tr<tc1
endif (size=-2)+(leading=-2)
gettextcursor => ...,a,b
if a<b
textselect -para
textcursor +para
endif
gettextcursor => ...,tc,tc1
endwhile
endif
endif
endloop
deselect
// Post Step 2: remove extra text from stories
getgrouplist idg >> N,grouplist
loop n=1,N
set grouplist >> id,...,...,...,typ,...,...,...,...,...,...,...,...,...,...,grouplist
if typ=1
selectid id
textedit
gettextcursor >> ...,pos,...
if pos=0
settextcursor -2,begin.tmp[id],end.tmp[id]
clear
endif
deselect
endif
endloop
selectid idg
return